#pragma once
#include <lvgl.h>
#include <gui.hpp>

/*!USER_DECLARE_BEGIN!*/
/*!USER_DECLARE_END!*/

// ---------------- 资源声明 ----------------
extern "C" {
    // 字体声明
    LV_FONT_DECLARE(lv_customer_font_SourceHanSerifSC_Regular_13)
    /*!USER_DECLARE_BEGIN!*/
    /*!USER_DECLARE_END!*/
    // 图片声明
    
    /*!USER_DECLARE_BEGIN!*/
    /*!USER_DECLARE_END!*/
    // 其他
    /*!USER_DECLARE_BEGIN!*/
    /*!USER_DECLARE_END!*/
}

// ---------------- 组件定义 ----------------
namespace gui::widgets::main {
    using namespace gui::compose;
    inline Component screen;
	inline Button screen_btn_1;
	inline Label screen_btn_1_label;
	inline Button screen_btn_2;
	inline Label screen_btn_2_label;
	inline Button screen_btn_3;
	inline Label screen_btn_3_label;
	inline Button screen_btn_4;
	inline Label screen_btn_4_label;
	inline Button screen_btn_5;
	inline Label screen_btn_5_label;
    /*!USER_DECLARE_BEGIN!*/
    /*!USER_DECLARE_END!*/
}

// ================== 用户空间 ==================
/*!USER_DECLARE_BEGIN!*/

/*!USER_DECLARE_END!*/

// ---------------- UI接口 ----------------
namespace gui::interface {
    using namespace gui::widgets::main;
    /*!USER_DECLARE_BEGIN!*/

    /*!USER_DECLARE_END!*/
}

// ---------------- 初始化逻辑 ----------------
namespace gui
{
    class ui
    {
    public: 
        static void screenInit() {
            using namespace gui::widgets::main;
            
            screen.init(nullptr);
			screen.size(1024,600);
			screen.bg_opa(255);


			screen_btn_1.init(screen);
			screen_btn_1.pos(20,28);
			screen_btn_1.size(100,50);
			screen_btn_1.bg_opa(255);
			screen_btn_1.bg_color(lv_color_hex(0x2195f6));
			screen_btn_1.radius(5);
			screen_btn_1.text_color(lv_color_hex(0xffffff));
			screen_btn_1.text_align(LV_TEXT_ALIGN_CENTER);
			lv_obj_set_style_pad_all(screen_btn_1,0,LV_STATE_DEFAULT);
			lv_obj_set_style_text_font(screen_btn_1,&lv_customer_font_SourceHanSerifSC_Regular_13,selector_default);

			screen_btn_1_label.init(screen_btn_1);
			screen_btn_1_label.center(0,0);
			lv_label_set_text(screen_btn_1_label,"Button");
			lv_obj_set_width(screen_btn_1_label,LV_PCT(100));

			screen_btn_2.init(screen);
			screen_btn_2.pos(903,28);
			screen_btn_2.size(100,50);
			screen_btn_2.bg_opa(255);
			screen_btn_2.bg_color(lv_color_hex(0x2195f6));
			screen_btn_2.radius(5);
			screen_btn_2.text_color(lv_color_hex(0xffffff));
			screen_btn_2.text_align(LV_TEXT_ALIGN_CENTER);
			lv_obj_set_style_pad_all(screen_btn_2,0,LV_STATE_DEFAULT);
			lv_obj_set_style_text_font(screen_btn_2,&lv_customer_font_SourceHanSerifSC_Regular_13,selector_default);

			screen_btn_2_label.init(screen_btn_2);
			screen_btn_2_label.center(0,0);
			lv_label_set_text(screen_btn_2_label,"Button");
			lv_obj_set_width(screen_btn_2_label,LV_PCT(100));

			screen_btn_3.init(screen);
			screen_btn_3.pos(903,520);
			screen_btn_3.size(100,50);
			screen_btn_3.bg_opa(255);
			screen_btn_3.bg_color(lv_color_hex(0x2195f6));
			screen_btn_3.radius(5);
			screen_btn_3.text_color(lv_color_hex(0xffffff));
			screen_btn_3.text_align(LV_TEXT_ALIGN_CENTER);
			lv_obj_set_style_pad_all(screen_btn_3,0,LV_STATE_DEFAULT);
			lv_obj_set_style_text_font(screen_btn_3,&lv_customer_font_SourceHanSerifSC_Regular_13,selector_default);

			screen_btn_3_label.init(screen_btn_3);
			screen_btn_3_label.center(0,0);
			lv_label_set_text(screen_btn_3_label,"Button");
			lv_obj_set_width(screen_btn_3_label,LV_PCT(100));

			screen_btn_4.init(screen);
			screen_btn_4.pos(20,520);
			screen_btn_4.size(100,50);
			screen_btn_4.bg_opa(255);
			screen_btn_4.bg_color(lv_color_hex(0x2195f6));
			screen_btn_4.radius(5);
			screen_btn_4.text_color(lv_color_hex(0xffffff));
			screen_btn_4.text_align(LV_TEXT_ALIGN_CENTER);
			lv_obj_set_style_pad_all(screen_btn_4,0,LV_STATE_DEFAULT);
			lv_obj_set_style_text_font(screen_btn_4,&lv_customer_font_SourceHanSerifSC_Regular_13,selector_default);

			screen_btn_4_label.init(screen_btn_4);
			screen_btn_4_label.center(0,0);
			lv_label_set_text(screen_btn_4_label,"Button");
			lv_obj_set_width(screen_btn_4_label,LV_PCT(100));

			screen_btn_5.init(screen);
			screen_btn_5.pos(474,261);
			screen_btn_5.size(100,50);
			screen_btn_5.bg_opa(255);
			screen_btn_5.bg_color(lv_color_hex(0x2195f6));
			screen_btn_5.radius(5);
			screen_btn_5.text_color(lv_color_hex(0xffffff));
			screen_btn_5.text_align(LV_TEXT_ALIGN_CENTER);
			lv_obj_set_style_pad_all(screen_btn_5,0,LV_STATE_DEFAULT);
			lv_obj_set_style_text_font(screen_btn_5,&lv_customer_font_SourceHanSerifSC_Regular_13,selector_default);

			screen_btn_5_label.init(screen_btn_5);
			screen_btn_5_label.center(0,0);
			lv_label_set_text(screen_btn_5_label,"Button");
			lv_obj_set_width(screen_btn_5_label,LV_PCT(100));

            /*!USER_DECLARE_BEGIN!*/

/*!USER_DECLARE_END!*/
            lv_obj_update_layout(screen);// 更新布局
            lv_scr_load(screen);// 加载主屏幕
        }
        
        static void eventInit() {
            using namespace gui::widgets::main;
            /*!USER_DECLARE_BEGIN!*/

/*!USER_DECLARE_END!*/
        }
    };
}

/*!USER_DECLARE_BEGIN!*/
/*!USER_DECLARE_END!*/
